import java.util.*;

public class Text {
    public static void main(String[] args) {
        int[] array = new int[]{-4,-2,3,-1};
        System.out.println(maxScore(array));
    }
    public static int maxScore(int[] nums) {
        Arrays.sort(nums);
        int[] prefix = new int[nums.length];
        for(int i = nums.length -1; i>=0;i--) {
            for(int j = nums.length-1; j>=i;j--) {
                prefix[i] += nums[j];
            }
        }
        int count = 0;
        for(int i = 0;i < prefix.length;i++) {
            if(prefix[i] > 0) {
                count++;
            }
        }
        return count;
    }
}
